package com.zmkj.cn.sys.service.impl;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.zmkj.cn.comm.vo.CommonResultVo;
import com.zmkj.cn.sys.service.IWechatService;
import com.zmkj.cn.sys.vo.input.WxSendInputVo;

import lombok.extern.slf4j.Slf4j;

/**
 * 微信模版消息推送
 *
 * @author 伍绍宇
 * @date 2021/04/29
 */
@Service
@Slf4j
public class WechatServiceImpl extends WechatCommServiceImpl implements IWechatService {

    private static final Object SUCCESS = "success";

    /**
     * 转交模版
     */
    @Value("${wx.temp.order.transfer.code}")
    private String transferCode;

    @Value("${wx.temp.order.transfer.page}")
    private String transferPage;

    /**
     * 发送转交消息
     *
     * @author 伍绍宇
     * @date 2021/04/29
     */
    @Override
    public Object transferTemplate(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(transferCode);
        wxSendInputVo.setPage(transferPage);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }


    /**
     * 派单模版
     */
    @Value("${wx.temp.order.assign.code}")
    private String assignCode;

    @Value("${wx.temp.order.assign.page}")
    private String assignPage;

    /**
     * 发送派单消息
     *
     * @author 伍绍宇
     * @date 2021/04/29
     */
    @Override
    public Object assignTemplate(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(assignCode);
        wxSendInputVo.setPage(assignPage);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }


    /**
     * 处理进度模版
     */
    @Value("${wx.temp.order.make.code}")
    private String makeCode;

    @Value("${wx.temp.order.make.page}")
    private String makePage;

    /**
     * 发送处理进度消息
     *
     * @author 伍绍宇
     * @date 2021/04/29
     */
    @Override
    public Object makeTemplate(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(makeCode);
        wxSendInputVo.setPage(makePage);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }

    
    

    /**
     * 处理进度模版
     */
    @Value("${wx.temp.order.wechat.createorder.code}")
    private String wechatCreateOrder;


	@Override
	public Object weChatTemplate(WxSendInputVo wxSendInputVo) {
		wxSendInputVo.setCode(wechatCreateOrder);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
	}

	
	  /**
     * 处理进度模版
     */
    @Value("${wx.temp.order.asssit.code}")
    private String assistCode;
    
    @Value("${wx.temp.order.asssit.page}")
    private String assistPage;

    
    @Override
    public Object assistTemplate(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(assistCode);
        wxSendInputVo.setPage(assistPage);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }


    /**
     * 处理进度模版
     */
    @Value("${wx.temp.wechat.item.timeout.code}")
    private String itemTimeoutTemplateCode;
    @Override
    public Object itemTimeoutTemplate(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(itemTimeoutTemplateCode);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }

     /**
     * 排班模版
     */
    @Value("${wx.temp.wechat.schedule.code}")
    private String scheduleTemplateCode;
    @Override
    public Object scheduleMsg(WxSendInputVo wxSendInputVo) {
        wxSendInputVo.setCode(scheduleTemplateCode);
        sendEntrance(wxSendInputVo);
        return CommonResultVo.success(SUCCESS);
    }
    
	@Override
	public CommonResultVo<?> commonSendMsg(WxSendInputVo wxSendInputVo) {
		sendEntrance(wxSendInputVo);
		return CommonResultVo.success(SUCCESS);
	}



}
